<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        /*  //没块作用域
         if(true) { var c = 3 }
         console.log(c)
         */
        var a = 10,
            b = 20

        function fn(x) {
            var a = 100,
                c = 300;
            console.log('fn()', a, b, c, x) //100 20 300 10
            function bar(x) {
                var a = 1000,
                    d = 400
                console.log('bar()', a, b, c, d, x)
            }
            bar(100) //1000 20 300 400 100
            bar(200) //1000 20 300 400 200
        }
        fn(10)
    </script>
</body>

</html>